<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ES5继承</title>
</head>
<body>
  <script>
    // 组合继承
    function inherit(Parent, Child) {
      // 原型继承
      function Overworking() {}
      Overworking.prototype = Parent.prototype
      Child.prototype = new overworking()
      Child.prototype.constructor = Child
    }

    function Parent(options) {
      this.assets = options.assets
    }

    Parent.prototype.do = function () {
      console.log('如何快速赚钱！');
    }

    function Child(options) {
      // 构造函数继承
      Parent.call(this, options)
      this.name = options.name
      this.age = options.age
    }

    Child.prototype.do = function () {
      console.log('如何快速花钱！');
    }

    const jerry = new Child({
      name: 'jerry',
      age: 18,
      assets: '一百亿美金'
    })

    console.log(jerry);
    jerry.do()

  </script>
</body>
</html>